<?php

declare(strict_types=1);

/**
 * @Author:     Frank
 * @contact     frank_hhm@163.com
 * @Date:       2022-12-08 09:44:59
 * @Last Modified time: 2023-02-09 09:18:40
 */
namespace app\common\services\store;

use app\common\dao\store\ExpressCompanyDao;

use frank\base\BaseService;
use frank\exception\CommonException;
use frank\utils\helper\ArrayHelper;

/**
 * Class ExpressCompanyService
 */
class ExpressCompanyService extends BaseService
{

    /**
     * ExpressCompanyService constructor.
     * @param ExpressCompanyDao $dao
     */
    public function __construct(ExpressCompanyDao $dao)
    {
        $this->dao = $dao;
    }

    public function getExpressCompanyDetail($filter)
    {
        $detail = $this->dao->detail($filter);
        if (!$detail) {
            throw new CommonException('数据不存在');
        }
        return $detail->toArray();
    }

    /**
     * 获取服务列表
     */
    public function getExpressCompanyList(array $where)
    {
        [$page, $limit] = $this->getPageValue();
        $list = $this->dao->getExpressCompanyList($where, $page, $limit);
        return $list;
    }

    /**
     * 获取服务列表
     */
    public function getExpressCompanySelect(array $where = [])
    {
        $list = $this->dao->getExpressCompanySelect($where);
        return $list;
    }

}